import { createApp } from 'vue'
import { createPinia } from 'pinia'
import ElementPlus from 'element-plus'
import 'element-plus/dist/index.css'
import * as ElementPlusIconsVue from '@element-plus/icons-vue'
import App from './App.vue'
import router from './router'
import timerService from './utils/timerService'


// 等待 App 环境就绪（5+ App）
document.addEventListener('plusready', () => {
  const statusBarHeight = plus.navigator.getStatusbarHeight()
  document.documentElement.style.setProperty('--status-bar-height', `${statusBarHeight}px`)
   // 关键：给 html 标签添加 5+ App 标记类
    document.documentElement.classList.add('app-5plus')
})



const app = createApp(App)

// 注册所有图标
for (const [key, component] of Object.entries(ElementPlusIconsVue)) {
  app.component(key, component)
}

app.use(createPinia())
app.use(router)
app.use(ElementPlus)

// 初始化计时器服务
timerService.init().then(() => {
  console.log('计时器服务初始化完成')
  // console.log('服务状态:', timerService.getStatus())
}).catch(error => {
  console.error('计时器服务初始化失败:', error)
})

app.mount('#app') 

